import axios from 'axios';
import { ref, watch } from 'vue'

function useList() {
    const select = ref('张三')
    const list = ref([])

    watch(select, async (value) => {
        let result = await axios.get(`http://localhost:3000/news?author=${value}`);

        console.log(result.data);
        list.value = result.data;
    }, { immediate: true })

    return { select, list }
}

export default useList